<?php //strip
/**
 * Interface for the simplest database models. 
 *
 * @package odWpPlugin
 * @author Ondrej Donek <ondrejd@gmail.com>
 */
interface odWpPlugin_Model_Interface
{
  
  /**
   * Creates table in the database if doesn't already exists.
   *
   * @return boolean
   */
  public function createTable();
  
  /**
   * Drops table from the database if already exists.
   *
   * @return boolean
   */
  public function dropTable();
  
  /**
   * Add new column into the table.
  public function addColumn($aName = '', $aProperties = array());
  
  /**
   * Returns TRUE if column with given name exists in the model.
   *
   * @param string $aName Identifier of desired column.
   * @return boolean
   */
  public function hasColumn($aName = '');
  
  /**
   * Returns array with description of the column with given name.
   * If column wasn't found NULL is returned.
   *
   * @param string $aName Identifier of desired column.
   * @return array|null
   */
  public function getColumn($aName = '');
  
  /**
   * Returns array with columns descriptions that matches given filter. 
   * If filter is null are returned all columns.
   *
   * @param array|string|null $aName Identifier of desired column.
   * @return array
   */
  public function getColumns($aFilter = null);
  
  /**
   * Returns count of items which matches given filter.
   *
   * @param string $aFilter WHERE part of SQL query.
   * @return number
   */
  public function getCount($aFilter = '');
  
  /**
   * Insert new item(s) from the given values.
   *
   * @param array $aValues
   * @return boolean
   */
  public function insert($aValues = array());
  
  /**
   * Permanetly removes items which matches the filter from database. 
   * If only one matches the filter is returned its ID otherwise is returned
   * count of removed items.
   *
   * @param string $aFilter
   * @return integer
   */
  public function remove($aFilter = '');
  
  /**
   * Returns items which matches given filter.
   *
   * @param string $aFilter
   * @param number $aCount
   * @param number $aLimitFrom
   * @return array
   */
  public function select($aFilter = '', $aCount = 0, $aLimitFrom = 0);
  
  /**
   * Updates items which matches filter with the given values.
   *
   * @param string $aFilter
   * @param array $aValues
   * @return void
   */
  public function update($aFilter = '', $aValues = array());
  
} // End of odWpPlugin_Model_Interface
